Generally in moving picture coding, the amount of information is compressed using redundancy in spatial direction and temporal direction that a moving picture has. There is inter picture prediction coding as a method for using the redundancy in temporal direction. In the inter picture prediction coding, a temporary preceding picture or a temporary subsequent picture is used as a reference picture when a picture is coded. Then, motion amount is detected from the reference picture and the amount of information is compressed by removing redundancy in spatial direction toward a difference value between a picture to which motion compensation is performed and a picture to be coded.
In such a moving picture coding method, a picture that does not perform inter picture prediction coding, or equivalently, that performs intra picture prediction coding is called an I picture. Now, a picture means one unit of coding including both of a frame and a field. Additionally, a picture that performs the inter picture prediction coding with reference to one previously processed picture is called a P picture while a picture that performs the inter picture prediction coding with reference to two previously processed picture is called a B picture.
As for a B picture, its pixel values are predicted (also called “weighted prediction”) and its motion vector is calculated based on two reference pictures and by scaling processing (a proportional calculation based on the distances among the B picture and the two reference pictures). As the distances among the pictures, there are a difference in time information that the pictures have, a difference in picture numbers assigned to each picture, and a difference in information showing the display order of pictures.
FIG. 1 shows an example of prior art that indicates a process for calculating predictive pixel values in a B picture by weighted prediction based on two reference pictures. As shown in the figure, a predictive pixel value P is determined by weighted addition using the pixel values PO and P1 of two reference picture blocks 1 and 2. Both of weighting coefficients a and b in the formula are, for example, ½.
FIG. 2 and FIG. 3 show other examples that indicate the process for calculating predictive pixel values in a B picture (a block to be coded) by performing scaling based on two reference pictures (blocks land 2) (for example, refer to Joint Video Team (JTV) of ISO/IEC MPEG and ITU-T VCEG Joint Committee Draft 2002-05-10, JVT-C167 11.). Here, FIG. 2 shows an example when a B picture (a block to be coded) refers to a forward picture (block 1) and a backward picture (block 2) while FIG. 3 shows an example when a B picture (a block to be coded) refers to two forward pictures (blocks 1 and 2). By the way, W0 and W1 in the figures are weighting coefficients in scaling processing (here, weighted prediction of a pixel value). W0 is a weighting coefficient by which the pixel value in the block 1 is multiplied while W1 is a weighting coefficient by which the pixel value in the block 2 is multiplied. W0 and W1 are expressed by the following formulas.W0=(128×(T1−T))/(T1−T0)   (Formula 1)W1=(128×(T−T0))/(T1−T0)   (Formula 2)
Here, T, T0, and T1 are time (such as a time stamp) added to the block to be coded, the forward reference block 1 and the backward reference block 2, respectively.
At this time, the pixel value P in the block to be coded is expressed by the following formula.P=(P0×W0+P1×W1+64)>>7   (Formula 3)
Here, “>>” means a bit shift to the right direction. In other words, “>>7” means “÷(2 to the 7th power)”. In addition, the above-mentioned Formula 3 is used when the pixel value indicates the value of a luminance signal. When the pixel value indicates the value of chrominance, the chrominance is expressed by the following formula.P=128+((P0−128)×W0+(P1−128)×W1+64)>>7   (Formula 4)
FIG. 4 is a flowchart showing concrete calculation steps using these formulas. After Time T, T1 and T0 and pixel values P0 and P1 are obtained (Step S401), whether Time T1 is equal to Time 0, in other words, whether the denominator of the weighting coefficients W0 and W1 in Formulas 1 and 2 is 0 or not is judged (Step S402). When the denominator is 0 (Yes; Step S402), it is determined that the weighting coefficients W0 and W1 are both 128 (Step S403). When the denominator is not 0 (No; Step 402), the weighting coefficients W0 and W1 are calculated according to above-mentioned Formulas 1 and 2 (Step S404). Lastly, the predictive pixel value P in the block to be coded is calculated using the weighting coefficients W0 and W1 and the pixel value P0 in the reference block 1 and the pixel value P1 in the reference block 2 according to above-mentioned Formula 3 or Formula 4 (Step S405). As described above, the predictive pixel value in the block to be coded is calculated using the pixel values in the two reference blocks and performing temporal scaling.
Incidentally, in temporal scaling processing like this, divisions are necessary to calculate weighting coefficients as above-mentioned Formulas 1 and 2 show. Since the resource necessary for divisions is larger than that necessary for multiplications, it is common to calculate reciprocals of divisions in advance, store them in a look-up table and the like and perform multiplications using the reciprocals instead of performing divisions.
Note that the block 1 and the block 2 in FIGS. 1 to 3 are P pictures but it is acceptable that the blocks are I pictures or B pictures and are not necessarily P pictures.
In the method using the reciprocals calculated in advance, however, when the kinds of divisions in formulas for calculating weighting coefficients are many, the kinds of reciprocals calculated in advance also become many. For example, when possible values of T0 and T1 shown in Formulas 1 and 2 are 30 ways, respectively, by a simple calculation, 900 ways of divisions are necessary for calculating reciprocals and the reciprocal calculation amount becomes extremely large. Further, there is another problem that large storage capacity of the look-up table and the like that store the reciprocals is necessary.
Moreover, when the denominators (the devisors of the weighting coefficients) in above-mentioned Formulas 1 and 2 become small, the weighting coefficients (the quotients) become extremely large and there is a problem, for example, that the predictive pixel values cross a value that can be expressed by 16 bits. Therefore, for example, a 32-bit calculation becomes necessary and since the significant digit number necessary for the calculations increases, the size of a calculation apparatus becomes large.